package com.stk.triplecity;

import java.util.ArrayList;

import com.stk.triplecity.R;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

public class Images {
	private Bitmap level0type1; 
	private Bitmap level1type1; 
	private Bitmap level2type1; 
	private Bitmap level3type1; 
	private Bitmap level4type1; 
	private Bitmap level5type1; 
	private Bitmap level6type1; 
	private Bitmap level7type1; 
	private Bitmap level8type1; 
	private Bitmap level9type1; 
	private Bitmap level0type2;
	private Bitmap level1type2;
	private Bitmap level2type2;
	private Bitmap level1type31;
	private Bitmap level1type32;
	private Bitmap level1type33;
	private Bitmap level1type34;
	private Bitmap level1type35;
	private Bitmap level1type36;
	private Bitmap level2type30;
	private Bitmap level2type31;
	private Bitmap level2type32;
	private Bitmap level2type33;
	private Bitmap level2type34;
	private Bitmap level2type35;
	private Bitmap level2type36;
	private Bitmap level2type37;
	private Bitmap level2type38;
	private Bitmap level2type39;
	private Bitmap level3type3;
	private Bitmap level4type3;
	private Bitmap level1type4;
	private Bitmap level2type4;
	private Bitmap level3type4;
	private int[] levels;
	private static Images instance=null;
	
	
	public Images(Panel p){
		levels = new int[]{9,2,4,3};
		level0type1 = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(p.getResources(), R.drawable.level0type1), p.getTileSize(), p.getTileSize(), true);
		level1type1 = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(p.getResources(), R.drawable.level1type1), p.getTileSize(), p.getTileSize(), true);
		level2type1 = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(p.getResources(), R.drawable.level2type1), p.getTileSize(), p.getTileSize(), true);
		level3type1 = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(p.getResources(), R.drawable.level3type1), p.getTileSize(), p.getTileSize(), true);
		level4type1 = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(p.getResources(), R.drawable.level4type1), p.getTileSize(), p.getTileSize(), true);
		level5type1 = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(p.getResources(), R.drawable.level5type1), p.getTileSize(), p.getTileSize(), true);
		level6type1 = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(p.getResources(), R.drawable.level6type1), p.getTileSize(), p.getTileSize(), true);
		level7type1 = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(p.getResources(), R.drawable.level7type1), p.getTileSize(), p.getTileSize(), true);
		level8type1 = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(p.getResources(), R.drawable.level8type1), p.getTileSize(), p.getTileSize(), true);
		level9type1 = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(p.getResources(), R.drawable.level9type1), p.getTileSize(), p.getTileSize(), true);
		level0type2 = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(p.getResources(), R.drawable.level0type2), p.getTileSize(), p.getTileSize(), true);
		level1type2 = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(p.getResources(), R.drawable.level1type2), p.getTileSize(), p.getTileSize(), true);
		level2type2 = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(p.getResources(), R.drawable.level2type2), p.getTileSize(), p.getTileSize(), true);
		level1type31 = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(p.getResources(), R.drawable.level1type31), p.getTileSize(), p.getTileSize(), true);
		level1type32 = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(p.getResources(), R.drawable.level1type32), p.getTileSize(), p.getTileSize(), true);
		level1type33 = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(p.getResources(), R.drawable.level1type33), p.getTileSize(), p.getTileSize(), true);
		level1type34 = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(p.getResources(), R.drawable.level1type34), p.getTileSize(), p.getTileSize(), true);
		level1type35 = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(p.getResources(), R.drawable.level1type35), p.getTileSize(), p.getTileSize(), true);
		level1type36 = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(p.getResources(), R.drawable.level1type36), p.getTileSize(), p.getTileSize(), true);
		level2type30 = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(p.getResources(), R.drawable.level2type30), p.getTileSize(), p.getTileSize(), true);
		level2type31 = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(p.getResources(), R.drawable.level2type31), p.getTileSize(), p.getTileSize(), true);
		level2type32 = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(p.getResources(), R.drawable.level2type32), p.getTileSize(), p.getTileSize(), true);
		level2type33 = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(p.getResources(), R.drawable.level2type33), p.getTileSize(), p.getTileSize(), true);
		level2type34 = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(p.getResources(), R.drawable.level2type34), p.getTileSize(), p.getTileSize(), true);
		level2type35 = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(p.getResources(), R.drawable.level2type35), p.getTileSize(), p.getTileSize(), true);
		level2type36 = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(p.getResources(), R.drawable.level2type36), p.getTileSize(), p.getTileSize(), true);
		level2type37 = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(p.getResources(), R.drawable.level2type37), p.getTileSize(), p.getTileSize(), true);
		level2type38 = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(p.getResources(), R.drawable.level2type38), p.getTileSize(), p.getTileSize(), true);
		level2type39 = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(p.getResources(), R.drawable.level2type39), p.getTileSize(), p.getTileSize(), true);
		level3type3 = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(p.getResources(), R.drawable.level3type3), p.getTileSize(), p.getTileSize(), true);
		level4type3 = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(p.getResources(), R.drawable.level4type3), p.getTileSize(), p.getTileSize(), true);
		level1type4 = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(p.getResources(), R.drawable.level1type4), p.getTileSize(), p.getTileSize(), true);
		level2type4 = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(p.getResources(), R.drawable.level2type4), p.getTileSize(), p.getTileSize(), true);
		level3type4 = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(p.getResources(), R.drawable.level3type4), p.getTileSize(), p.getTileSize(), true);
	}
	
	public static Images getInstance(Panel p){
		if (instance==null){
			instance = new Images(p);
		}
		return instance;
	}

	public ArrayList<Bitmap> getImage(int level, int type){
		ArrayList<Bitmap> ret =  new ArrayList<Bitmap>();
		switch (type){
		case 1: switch(level){
		case 0 : ret.add(level0type1);
		return ret;
		case 1 : ret.add(level1type1);
		return ret;
		case 2 : ret.add(level2type1);
		return ret;
		case 3 : ret.add(level3type1);
		return ret;
		case 4 : ret.add(level4type1);
		return ret;
		case 5 : ret.add(level5type1);
		return ret;
		case 6 : ret.add(level6type1);
		return ret;
		case 7 : ret.add(level7type1);
		return ret;
		case 8 : ret.add(level8type1);
		return ret;
		case 9 : ret.add(level9type1);
		return ret;	
		}
		case 2: switch(level){
		case 0 : ret.add(level0type2);
		return ret;
		case 1 : ret.add(level1type2);
		return ret;
		case 2 : ret.add(level2type2);
		return ret;
		}
		case 3: switch(level){
		case 1 : ret.add(level1type31);
				ret.add(level1type32);
				ret.add(level1type33);
				ret.add(level1type34);
				ret.add(level1type35);
				ret.add(level1type36);
		return ret;
		case 2 : ret.add(level2type30);
				ret.add(level2type31);
				ret.add(level2type32);
				ret.add(level2type33);
				ret.add(level2type34);
				ret.add(level2type35);
				ret.add(level2type36);
				ret.add(level2type37);
				ret.add(level2type38);
				ret.add(level2type39);
		return ret;
		case 3 : ret.add(level3type3);
		return ret;
		case 4 : ret.add(level4type3);
		return ret;
		}
		case 4: switch(level){
		case 1 : ret.add(level1type4);
		return ret;
		case 2 : ret.add(level2type4);
		return ret;
		case 3 : ret.add(level3type4);
		return ret;
		}
		}
		return null;
	}

	public int[] getLevels() {
		return levels;
	}


}
